/**
 * 
 */
package net.openl10n.adapters;

import java.util.LinkedList;

import net.openl10n.adapters.DocumentStreamReader.Event;

public class EventStack{
	
	private final LinkedList<Event> eventStack;
	private final boolean validating;
	
	public EventStack() {
		this(true);
	}
	
	public EventStack(boolean validating) {
		eventStack = new LinkedList<Event>();
		this.validating = validating;
	}
	
	public boolean isEmpty () {
		return eventStack.isEmpty() ;
	}
	
	public Event pop(){
		return eventStack.pop();
	}
	
	public Event peek() {
		return eventStack.peek();
	}
	
	private void validate() throws IllegalStateException{
		
	}
	public void push(Event event) throws IllegalStateException{
		if (validating) validate();
		eventStack.push(event);
	}
	
	public int size(){
		return eventStack.size();
	}
	
}